<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // 发现 多种变量 形容的是同一种东西
    // (名词 形容词性)  定义成属性
    // 动作行为 定为方法
    // 缺点，对象一多，代码量变多
    // 字面量的对象
    let yongkang = {
        name : "永康",
        age :28,
        school : '青芒',
        work : function () {
            console.log("犯错，骂人");
        }
    } 

    // 重复没有规律
    // 构造函数
    function person (nn,aa,ss) {
        this.name = nn
        this.age = aa
        this.school = ss
        this.work = function (str) {
            console.log(str);
        }
    }

    function person(name,age,school) {
        return {
            name,age,school,
            work(str){
                console.log(str);
            }
        }
    }

    function person(name,age,school) {
        return {
            name,age,school,work:str => {console.log(str);}
        }
    }

    let person = (name,age,school) => ({name,age,school,work:str=>console.log(str)})

    let per = person("子康",20,"清华")
    per.work("熬夜打游戏")
    console.log(per);
    </script>
</body>
</html>